package me.trytofeel.controller;

import lombok.Data;
import me.trytofeel.bean.Video;
import me.trytofeel.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Data
@Controller
public class VideoController {
    @Autowired
    private VideoService videoService;

    public String insertVideo(Video video) {
        return videoService.insertVideo(video) ? "添加成功" : "添加失败";
    }

    public String deleteVideoById(int id) {
        return videoService.deleteVideoById(id) ? "删除成功" : "删除失败";
    }

    public String updateVideo(Video video) {
        return videoService.updateVideo(video) ? "更新成功" : "更新失败";
    }

    public List<Video> selectAllVideos() {
        return videoService.selectAllVideos();
    }

    public Video selectVideoById(int id) {
        return videoService.selectVideoById(id);
    }

}
